package com.android.danaobank.mvp.presenter;

import com.alibaba.fastjson.JSONObject;
import com.android.danaobank.api.ApiClient;
import com.android.danaobank.model.HttpResponse;
import com.android.danaobank.model.response.Product;
import com.android.danaobank.model.response.ProductResponse;
import com.lg.meng.base.IPaginationListView;
import com.lg.meng.base.PaginationListPresenter;

import java.util.List;

public class MallCommentProductPresenter extends PaginationListPresenter<
        HttpResponse<ProductResponse>, Product, IPaginationListView<HttpResponse<ProductResponse>, Product>
        > {
    public MallCommentProductPresenter() {
        pageZise = 6;
    }

    private JSONObject jsonObject;

    public void init(JSONObject jsonObject){
        this.jsonObject = jsonObject;
    }

    @Override
    public void loadData() {
        loadData(ApiClient.getInstance().getCommentProductList(page, pageZise, jsonObject));
    }

    @Override
    protected List<Product> getList(HttpResponse<ProductResponse> datas) {
        return datas.getData().getProductList();
    }
}
